# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilter do
  @moduledoc """
  Filters to select target VMs for an assignment. If more than one filter criteria is specified below, a VM will be selected if and only if it satisfies all of them.

  ## Attributes

  *   `all` (*type:* `boolean()`, *default:* `nil`) - Target all VMs in the project. If true, no other criteria is permitted.
  *   `exclusionLabels` (*type:* `list(GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentLabelSet.t)`, *default:* `nil`) - List of label sets used for VM exclusion. If the list has more than one label set, the VM is excluded if any of the label sets are applicable for the VM.
  *   `inclusionLabels` (*type:* `list(GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentLabelSet.t)`, *default:* `nil`) - List of label sets used for VM inclusion. If the list has more than one `LabelSet`, the VM is included if any of the label sets are applicable for the VM.
  *   `inventories` (*type:* `list(GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilterInventory.t)`, *default:* `nil`) - List of inventories to select VMs. A VM is selected if its inventory data matches at least one of the following inventories.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :all => boolean() | nil,
          :exclusionLabels =>
            list(GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentLabelSet.t()) | nil,
          :inclusionLabels =>
            list(GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentLabelSet.t()) | nil,
          :inventories =>
            list(GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilterInventory.t()) | nil
        }

  field(:all)
  field(:exclusionLabels, as: GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentLabelSet, type: :list)
  field(:inclusionLabels, as: GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentLabelSet, type: :list)

  field(:inventories,
    as: GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilterInventory,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilter do
  def decode(value, options) do
    GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilter.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.OSConfig.V1.Model.OSPolicyAssignmentInstanceFilter do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
